fix(transcribe): env pass-through for yt-dlp cookies and JS runtimes - #3050
fix(transcribe): env pass-through for yt-dlp cookies and JS runtimes#3050Azeem1985 wants to merge 1 commit into
Conversation
…om the environment YouTube answers datacenter IPs with 'Sign in to confirm you're not a bot'; yt-dlp's FAQ prescribes browser cookies, and its YouTube extractor wants a JS runtime for full format coverage. Both are CLI-reachable but the embedded YoutubeDL call in download_audio() hardcoded its options, so a cookies file the user exported had no way in. Mirror the transcriber's existing env convention (GRAPHIFY_WHISPER_MODEL): - GRAPHIFY_YTDLP_COOKIES -> cookiefile (yt-dlp --cookies) - GRAPHIFY_YTDLP_JS_RUNTIMES -> js_runtimes (yt-dlp --js-runtimes), e.g. 'node' No env vars set -> options unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Adds _ytdlp_env_opts so download_audio reads GRAPHIFY_YTDLP_COOKIES and GRAPHIFY_YTDLP_JS_RUNTIMES from the environment and forwards them to yt-dlp as cookiefile and js_runtimes, letting the embedded API supply browser cookies and a JS runtime to get past YouTube's bot check. With neither var set the options stay empty, so existing behaviour is unchanged.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 205 functions depend on the 48 functions this change touches.
Health — this change adds coupling hotspots:
- new:
dispatch_command()— 2 callers, 122 callees - new:
transcribe()— 5 callers, 5 callees - new:
ingest()— 3 callers, 8 callees - new:
download_audio()— 4 callers, 3 callees - new:
test_poisoned_manifest_is_healed()— 0 callers, 6 callees
Verification — 205 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 51 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify download\_audio.
The verifier did not have enough to check download\_audio, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `output_dir` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 grounded finding(s) anchored inline below; 4 more finding(s) on lines outside this diff (see the check run).
| return opts | ||
|
|
||
|
|
||
| def download_audio(url: str, output_dir: Path) -> Path: |
There was a problem hiding this comment.
download_audio()
high coupling complexity (Ca·Ce = 12).
Grounded coupling-delta finding (deterministic), not an LLM guess.
|
Thanks for the review — glad to see the gate come back clean. For what it's worth, our fork (TelB-io/graphify) has been running this change in production: with the env vars unset it's a no-op as described, and with them set it gets yt-dlp past YouTube's bot check reliably. Happy to adjust anything if the maintainers want changes before merge. |
Fixes #3049.
download_audio()hardcodes its embeddedYoutubeDLoptions, so on server IPs where YouTube answersSign in to confirm you're not a bot(yt-dlp's FAQ prescribes browser cookies for this), the user's exported cookies file has no way in — and neither does--js-runtimes node, which yt-dlp's YouTube extractor wants for full format coverage.This mirrors the module's existing env convention (
GRAPHIFY_WHISPER_MODEL,GRAPHIFY_WHISPER_PROMPT):GRAPHIFY_YTDLP_COOKIES→cookiefile(same asyt-dlp --cookies)GRAPHIFY_YTDLP_JS_RUNTIMES→js_runtimes(same asyt-dlp --js-runtimes), e.g.nodeWith neither set, the options dict is byte-identical to before. 4 new tests;
tests/test_transcribe.pypasses (15). Applies clean on v8 (0.9.49).🤖 Generated with Claude Code